<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AI 助手 - 筑梦智程</title>
    <link rel="icon" type="image/x-icon" href="https://pic.imgdb.cn/item/66e93bfef21886ccc0d210d1.jpg"/>
    <link rel="stylesheet" href="./index.css">
    <style>
        body {
            background-color: #f0f2f5;
            margin: 0;
            padding: 0;
        }
        .header {
            background-color: #007bff;
            color: white;
            padding: 15px 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 1000;
        }
        .back-button {
            color: white;
            text-decoration: none;
            font-size: 1rem;
        }
        .theme-switch-wrapper {
            display: flex;
            align-items: center;
        }
        .theme-switch {
            display: inline-block;
            height: 34px;
            position: relative;
            width: 60px;
        }
        .theme-switch input {
            display: none;
        }
        .slider {
            background-color: #ccc;
            bottom: 0;
            cursor: pointer;
            left: 0;
            position: absolute;
            right: 0;
            top: 0;
            transition: .4s;
            border-radius: 34px;
        }
        .slider:before {
            background-color: #fff;
            bottom: 4px;
            content: "";
            height: 26px;
            left: 4px;
            position: absolute;
            transition: .4s;
            width: 26px;
            border-radius: 50%;
        }
        input:checked + .slider {
            background-color: #66bb6a;
        }
        input:checked + .slider:before {
            transform: translateX(26px);
        }
        .chat-container {
            max-width: 800px;
            margin: 80px auto 20px;
            background-color: #ffffff;
            border-radius: 12px;
            box-shadow: 0 5px 15px rgba(0,0,0,0.1);
            overflow: hidden;
        }
        .chat-header {
            background-color: #007bff;
            color: white;
            padding: 20px;
            text-align: center;
            font-size: 1.5rem;
        }
        #chatMessages {
            height: 400px;
            overflow-y: auto;
            padding: 20px;
            background-color: #f9f9f9;
        }
        .chat-message {
            margin-bottom: 15px;
            padding: 10px 15px;
            border-radius: 18px;
            max-width: 80%;
            word-wrap: break-word;
        }
        .chat-message.user {
            background-color: #007bff;
            color: white;
            align-self: flex-end;
            margin-left: auto;
        }
        .chat-message.ai {
            background-color: #e9ecef;
            color: #333;
            align-self: flex-start;
        }
        #input-area {
            display: flex;
            padding: 20px;
            background-color: white;
            border-top: 1px solid #e0e0e0;
        }
        #userInput {
            flex-grow: 1;
            padding: 10px 15px;
            border: 1px solid #ced4da;
            border-radius: 20px;
            font-size: 1rem;
        }
        #sendButton {
            margin-left: 10px;
            padding: 10px 20px;
            background-color: #007bff;
            color: white;
            border: none;
            border-radius: 20px;
            cursor: pointer;
            transition: background-color 0.3s;
        }
        #sendButton:hover {
            background-color: #0056b3;
        }
        
        /* 暗黑模式样式 */
        body.dark-theme {
            background-color: #1a1a1a;
            color: #f0f0f0;
        }
        body.dark-theme .chat-container {
            background-color: #2a2a2a;
        }
        body.dark-theme #chatMessages {
            background-color: #333;
        }
        body.dark-theme .chat-message.ai {
            background-color: #444;
            color: #f0f0f0;
        }
        body.dark-theme #userInput {
            background-color: #333;
            color: #f0f0f0;
            border-color: #555;
        }
    </style>
</head>
<body>
    <header class="header">
        <a href="index.html" class="back-button">返回首页</a>
        <div class="theme-switch-wrapper">
            <label class="theme-switch" for="checkbox">
                <input type="checkbox" id="checkbox" />
                <div class="slider round"></div>
            </label>
        </div>
    </header>
    <div class="chat-container">
        <div class="chat-header">
            AI 助手
        </div>
        <div id="chatMessages"></div>
        <div id="input-area">
            <input type="text" id="userInput" placeholder="输入您的问题...">
            <button id="sendButton">发送</button>
        </div>
    </div>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/jsrsasign/10.5.18/jsrsasign-all-min.js"></script>
    <script src="ai-chat.js"></script>
    <script src="theme-switch.js"></script>
</body>
</html>